﻿@using IterationLife.Extensions.EasyUI.GridColumns
@using IterationLife.FootballTeaching.Queries
@using Util.Ui
@model IterationLife.PlatformBackEnd.AppServices.Dtos.FootballTeachings.LessonDto
@{
    var x = @Html.EasyUi();
}
<script type="text/javascript">
    var grid_lesson_refresh = function () {
        $.easyui.refresh("formQuery_lesson", "grid_lesson");
    }
</script>

@using (x.Layout(true).Begin())
{
    using (x.LayoutRegion().Top().Height(65).Begin())
    {
        <div class="titlebar">
            <span class="title">当前章节：</span>
            <span>@Model.ChapterName</span>
        </div>
        <div class="toolbar">
            @x.DialogButton("添加课时", $"/FootballTeachings/lesson/newdto?chapterId={Model.ChapterId}").Icon("icon-add").Plain().OnClose("grid_lesson_refresh").DialogSize(1300,850)
            @x.DialogButton("编辑课时", "/FootballTeachings/lesson/edit").Id("btnEdit_lesson").Icon("icon-edit").Plain().ShowEditDialog("grid_lesson").OnClose("grid_lesson_refresh").DialogSize(1300, 850)
            @x.Button("删除课时").Icon("icon-delete").Plain().Delete("/FootballTeachings/lesson/delete", "", "grid_lesson")
            @x.DialogButton("查看详细", "/FootballTeachings/lesson/detail").Id("btnLook").Icon("icon-look").Plain().ShowDetailDialog("grid_lesson").DialogSize(1000,600)
            @x.Button("刷 新").Icon("icon-refresh").Plain().Refresh("formQuery_lesson", "grid_lesson")
        </div>
    }
    using (x.LayoutRegion().Center().Begin())
    {
        @Html.Partial("Parts/QueryForm", new LessonQuery { ChapterId = Model.ChapterId })
        @(x.Grid("grid_lesson").Sort("SortId", false).Toolbar("divQuery_lesson").Url($"/FootballTeachings/Lesson/PagerQuery?ChapterId={Model.ChapterId}")
        .ShowEditDialogByDblClick("btnEdit_lesson").Menu().FitColumns().Fit()
        .Columns(
            x.GridColumn(t => t.Id).CheckBox(),
            x.GridColumn(t => t.Name, 100),
            x.GridColumn(t => t.Banner, 100).AttachmentPreview(),
            x.GridColumn(t => t.Video, 100).AttachmentPreview(),
            x.GridColumn(t => t.Difficulty, 100),
            x.GridColumn(t => t.Requirement, 100),
            x.GridColumn(t => t.SortId, 100),
            x.GridColumn(t => t.CreationTime, 120)
        )
        )
    }
}